package bairui.international.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;

import bairui.international.model.domain.jpa.TB_ProductCategoryProperty;
import bairui.international.model.domain.jpa.TB_ProductCategoryPropertyItem;
import bairui.international.model.domain.jpa.TB_ProductPropertyItem;
import bairui.international.service.Service_ProductCategoryPropertyItem;

/**
 * 
 * 【(产品分类属性项)TB_ProductCategoryPropertyItem】服务实现
 *
 * @generated
 * 
 * @see bairui.international.model.domain.jpa.TB_ProductCategoryPropertyItem 模型
 * @see Service_ProductCategoryPropertyItem 服务接口
 * @see BService_ProductCategoryPropertyItemImpl 服务实现基础
 *
 */
@Service
public class Service_ProductCategoryPropertyItemImpl extends BService_ProductCategoryPropertyItemImpl implements Service_ProductCategoryPropertyItem {

	private TB_ProductCategoryPropertyItem createInstance(TB_ProductCategoryProperty productCategoryProperty, TB_ProductPropertyItem productPropertyItem){
		return dao.save(new TB_ProductCategoryPropertyItem(
				new TB_ProductCategoryPropertyItem.MustProperties() {
					@Override public TB_ProductCategoryProperty getProductCategoryProperty() {
						return productCategoryProperty;
					}
					@Override public TB_ProductPropertyItem getProductPropertyItem() {
						return productPropertyItem;
					}
				},
				new TB_ProductCategoryPropertyItem.OptionalSingleProperties() {
				}
			));
	}
	
	@Override
	public TB_ProductCategoryPropertyItem create(TB_ProductCategoryProperty productCategoryProperty, TB_ProductPropertyItem productPropertyItem) {
		return createInstance(productCategoryProperty, productPropertyItem);
	}

	@Override
	public List<TB_ProductCategoryPropertyItem> create(TB_ProductCategoryProperty productCategoryProperty, List<TB_ProductPropertyItem> productPropertyItems) {
		List<TB_ProductCategoryPropertyItem> beans = new ArrayList<>();
		for(TB_ProductPropertyItem productPropertyItem : productPropertyItems){
			beans.add(create(productCategoryProperty, productPropertyItem));
		}
		return beans;
	}

}
